#!coding=utf-8
from django.db import models
from django.contrib.auth.models import User

class LogInfo(models.Model):
    TYPE_CHOICES = ((1, u'登录'), (2, u'注销'), (3, u'查询'), (4, u'修改'), (5, u'删除'), (6, u'新增'))
    
    user = models.ForeignKey(User,verbose_name=u'用户')
    operate_type = models.IntegerField(u'操作类型', choices=TYPE_CHOICES)
    operate_ip = models.CharField(verbose_name=u'操作ip', max_length=30)
    content = models.TextField(verbose_name=u'操作内容',blank=True,null=True)
    create_time = models.DateTimeField(verbose_name=u'创建时间', auto_now_add=True)

    class Meta:
        verbose_name = u'操作日志'
        verbose_name_plural = u'操作日志管理'

    def __unicode__(self):
        return '%s' % (self.user.username)
